import { reqGetSearchListData } from "@/api"
export default {
  namespaced: true,
  state: {
    goodsIntro: {}
  },
  mutations: {
    SetGoodsIntro(state, goodsIntro) {
      state.goodsIntro = goodsIntro
    }
  },
  actions: {
    async GetGoodsIntroListData({ commit }, searchParams) {
      let { data, code } = await reqGetSearchListData(searchParams)

      if (code === 200) {
        commit("SetGoodsIntro", data)
      } else {
        console.log("失败了！")
      }
    }
  },
  getters: {
    // attrsList goodsList trademarkList
    attrsList(state) {
      return state.goodsIntro.attrsList
    },
    goodsList(state){
      return state.goodsIntro.goodsList
    },
    trademarkList(state){
      return state.goodsIntro.trademarkList
    },
    total(state){
      return state.goodsIntro.total
    }
  }
}